package com.zxp.web.sys_user.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Date;

/**
 * @author MasterZ
 * @Date 2025/9/29 23:50
 */
@Data
@TableName("sys_user")
public class SysUser implements UserDetails {
//public class SysUser {
    @TableId(type = IdType.AUTO)
    private Long userId;
    private String username;
    private String password;
    private String email;
    private String phone;
    private String sex;
    private String isAdmin;
    @TableField(exist = false)//表示这个属性不在数据库表
    private String roleId;
    //帐户是否过期（1未过期，0已过期）
    private boolean isAccountNonExpired = true;
    //帐户是否被锁定（1未锁定，0已锁定）
    private boolean isAccountNonLocked = true;
    //密码是否过期（1未过期，0已过期）
    private boolean isCredentialsNonExpired = true;
    //帐户是否可用（1可用，0删除用户）
    @TableLogic(value = "1", delval = "0")
    private boolean isEnabled = true;
    private String nickName;
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
    private String createBy;
    private String updateBy;
    @TableField(exist = false)
    Collection<? extends GrantedAuthority> authorities;

}
